/**
 * Created by xieky on 2017/6/22.
 */
define(function (require, exports, module) {
    var angular = require('angular');
    require("pagination");
    require("angular-ui");
    require('/public/js/myservice/common/nav');
    var authorize = require('/public/js/myservice/authorize');
    var config = require('/public/js/myservice/config');
    var util = require("util");
    var api_prefix = G_CONFIG["api_prefix"]; //api前缀

    angular.module('reports',['ngUI','myNav'])
        .controller('reportsCtrl',['$scope',function($scope){

            //查询执行
            $scope.getData={
                keyword: '',
                doExecute:function(pageindex){
                    var url = api_prefix + "/out-storage/get-report-list";
                    util.myAjax({
                        url:url,
                        type:"POST",
                        context:'',
                        data:'',
                        success:function(resultdata){
                            if(resultdata.retCode == '0') {
                                $scope.reportlist = resultdata.data.data;
                                $scope.$applyAsync();
                            }else{
                                util.alert(resultdata.errMsg);
                            }
                        }
                    });
                }
            };
            
            $scope.showDetail = function (rptid) {
                var parms = {reportid:rptid};
                var url = api_prefix + "/out-storage/get-report-detail";
                util.myAjax({
                    url:url,
                    type:"POST",
                    context:'',
                    data:parms,
                    success:function(resultdata){
                        if(resultdata.retCode == '0') {
                            $('body').append(resultdata.data.data);
                        }else{
                            util.alert(resultdata.errMsg);
                        }
                    }
                });
            };

            $scope.getData.doExecute();

        }])
})